<template>
	<view class="content fofa poRel">
		<tabnav title="角色管理" :col="back"></tabnav>
		<view style="height: 60rpx;"></view>
		<scroll-view :style="'height: calc(100vh - 60rpx - 90rpx - '+tops+'px);'"
			@refresherrefresh="onPulling" :refresher-triggered="triggered"
			scroll-y="true" class="scroll-Y" @scrolltolower="lower" :refresher-enabled="true">
			<view class="wid100" v-if="list.length == 0">
				<view class="wid100" style="height: 220rpx;"></view>
				<view class="wid100 textCen">
					<image src="https://www.sign.run/applet/static/wenjian/wushuju.png" style="width: 306rpx;height: 200rpx;"></image>
					<view class="mar-top30 foSi25" style="color: #858585;">暂无角色</view>
				</view>
			</view>
			<view v-if="list.length != 0" @click="tiaozhuan('/pages/role/particulars?id='+item.id)"
			class="wid90 mar bacFFF borRad10 mar-bott30 box1" v-for="(item,index) in list" :key="index">
				<view style="height: 20rpx;"></view>
				<view class="wid90 mar dis disAl hei80">
					<view class="coFFF dis disAl disJuC foSi25 borRad10 mar-right30" 
						style="width: 71rpx;height: 51rpx;" :style="{'background-color':back}">系统</view>
					<view class="foSi30 fowe600" style="color: #000;">{{item.name}}</view>
				</view>
				<view class="wid90 mar overflowHidden foSi25 mar-top10" style="color: #B5B4B4;">关联权限：{{item.quanxian}}</view>
				<view class="wid90 mar overflowHidden foSi25 mar-top20" style="color: #B5B4B4;">关联员工：{{item.yuangong}}</view>
				<view style="height: 40rpx;"></view>
			</view>
			<view style="height: 140rpx"></view>
		</scroll-view>
		<view class="wid100 poAbs bacFFF dis disAl disJuC box1" style="height: 125rpx;bottom: 0;">
			<view class="hei80 dis disAl disJuC coFFF borRad10" @click="toggle('bottom')"
				style="width: 400rpx;" :style="{'background-color':back}">创建角色</view>
		</view>
		<uni-popup ref="popup" background-color="#fff">
			<view style="height: 20rpx;"></view>
			<view class="dis disAl disJuC foSi40 hei60">创建角色</view>
			<view class="wid90 mar foSi30 mar-top10" style="line-height: 42rpx;color: #858585;">请使用电脑访问
			<span @click="fuzhi" :style="'color: '+back+';'" style="margin: 0 10rpx;">https://www.baidu.com/</span>
			，登陆后进入「角色管理」进行操作</view>
			<view class="xia mar-top20"></view>
			<view class="wid90 mar dis disAl disJuB foSi35 mar-top20">
				<view class="hei80 dis disAl disJuC coFFF borRad10" :style="'background-color: '+back+';'" @click="fuzhi"
					style="width: 300rpx;">复制链接</view>
				<view class="hei80 dis disAl disJuC coFFF borRad10" :style="'background-color: '+back+';'" @click="guanbi"
				 style="width: 300rpx;">关闭</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import tabnav from "../common/tabnav/tabnav.vue"
	export default {
		components: {
			tabnav,
		},
		data() {
			return {
				back: uni.getStorageSync('back'),
				tops: 0,
				last_page: 0,
				page: 0,
				triggered: false,
				_freshing: false,
				list: [
					{
						id: 0,
						name: '测试', 
						yuangong: '张三、李四、王五', 
						quanxian: '合同类型管理、合同文件夹、起草合同、合同文件夹、合同文件夹、合同文件夹、合同文件夹、合同文件夹',
					},
					{
						id: 1,
						name: '测试', 
						yuangong: '张三、李四、王五', 
						quanxian: '合同类型管理、合同文件夹、起草合同、合同文件夹、合同文件夹、合同文件夹、合同文件夹、合同文件夹',
					},
				]
			}
		},
		onLoad() {
		},
		created() {
			var that = this
			uni.getSystemInfo({
				success: (e) => {
					console.log(e)
					that.tops = e.statusBarHeight
				}
			})
		},
		methods: {
			fuzhi(){
				uni.setClipboardData({
					data: 'https://www.baidu.com/'
				});
				this.guanbi()
			},
			toggle(type) {
				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				this.$refs.popup.open(type)
			},
			guanbi(){
				this.$refs.popup.close()
			},
			tiaozhuan(url){
				uni.navigateTo({
					url: url
				});
			},
			onPulling(e) {
				var that = this
				if (that._freshing) return;
				that._freshing = true;
				that.triggered = true
				console.log("onpulling", e);
				setTimeout(() => {
					that.triggered = false;
					that._freshing = false;
				}, 3000)
			},
			lower(e) {
				if(this.last_page != this.page+1){
					this.page++
				}
			},
		}
	}
</script>

<style>
	.content {
		height: 100vh;
		background-color: #F4F3F3;
	}
	.xia{
		height: 1rpx;
		background: #eaeaea;
	}
</style>
